<?php

$lang_from_to = str_replace("<#1>", "1.0.0", $lang_update['update_from_to']);
$lang_from_to = str_replace("<#2>", "1.0.6", $lang_from_to);

if($_GET['step']=="2"){
	mysql_query("UPDATE {$db_prefix}settings SET max_version='$ver_name'");
	
	mysql_query("CREATE TABLE `{$db_prefix}rss` (
	`id` int(11) NOT NULL auto_increment,
	`url_rss` varchar(500) NOT NULL ,
	`title_rss` varchar(255) NOT NULL ,
	`user_rss` int(11) NOT NULL default '1',
	`catg_rss` int(11) NOT NULL ,
	`check_rss` varchar(255) NOT NULL ,
	`post_rss` longtext NOT NULL ,
	`last_rss` varchar(255) NOT NULL ,
	`active_rss` int(11) NOT NULL ,
	PRIMARY KEY  (`id`)
	) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci");
	
	mysql_query("CREATE TABLE `{$db_prefix}tags` (
	`id` int(11) NOT NULL auto_increment,
	`tag` VARCHAR( 255 ) NOT NULL ,
	`topicid` int(11) NOT NULL ,
	`date` VARCHAR( 255 ) NOT NULL ,
	PRIMARY KEY  (`id`)
	) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci");
	
	mysql_query("INSERT INTO `{$db_prefix}bots` (`bot_id` ,`bot_name`) VALUES ('-62', 'Max4devBOT');");
	
	mysql_query("ALTER TABLE `{$db_prefix}settings` ADD `statistics_full` INT( 11 ) NOT NULL DEFAULT '1';");

	$array_table = array(
		"Rss ".$lang_update['upd_done']."",
		"Tags ".$lang_update['upd_done']."",
		"Bots ".$lang_update['upd_done']."",
		"Settings ".$lang_update['upd_done'].""
	);
	
	$html_ok = "<form method='post' onsubmit='return check_license()' action='upgrade.php'>";
	$html_ok .= "<br /><br /><div style='font: 16px Arial; font-weight: bold;'>";
	$html_ok .= "<center><input type='submit' class='img-submit' value='".$lang['submit_ok']."'/></center>";
	$html_ok .= "</form>";
	
}else{
	echo "<form method='post' onsubmit='return check_license()' action='upgrade.php?step=2'>";
	echo "<br /><br /><br /><br /><div style='font: 16px Arial; font-weight: bold;'>";
	echo "<center>".$lang_from_to."</center></div><br /><br /><br /><br />";
	echo "<input type='hidden' name='ver_name' value='1.0.6'/><div>";
	echo "<center><input type='submit' class='img-submit' value='".$lang['submit_ok']."'/></center>";
	echo "</form>";
}
?>